# coding:utf-8
"""
Given nums = [2, 7, 11, 15], target = 9,

Because nums[0] + nums[1] = 2 + 7 = 9,
return [0, 1].
"""
class Solution(object):
	def twoSum(self, nums, target):
		"""
		:type nums: List[int]
		:type target: int
		:rtype: List[int]
		process={}
        for index in range(len(num)):
            if target-num[index] in process:
                return [process[target-num[index]]+1,index+1]
            process[num[index]]=index
		"""
		res = list()
		for i,num1 in enumerate(nums):
			for j in range((i+1),len(nums)):
				#print i,',',j,'--',num1+nums[j]
				if (num1+nums[j])==target:
					res.append(i)
					res.append(j)
				
		return res


if __name__=='__main__':
	#print 'problems: 01 two-sum'
	solution = Solution()
	res = solution.twoSum([3,2,4],6)
	print res
	